package jmine.tec.di.resolver.impl;

import jmine.tec.annotations.Unmodifiable;
import jmine.tec.di.resolver.ObjectResolver;
import jmine.tec.di.type.TypeConverter;

/**
 * @author MarceloT
 */
@Unmodifiable
public class WithPreffixResolver extends AbstractManyObjectsResolver implements ObjectResolver {

    private final String prefix;

    /**
     * @param preffix prefixo
     * @param type tipo
     * @param typeConverter o conversor
     * @param keyType class
     * @param keyTypeConverter type converter
     */
    public WithPreffixResolver(String preffix, Class<?> type, final TypeConverter<?> typeConverter, Class<?> keyType,
            TypeConverter<?> keyTypeConverter) {
        super(type, typeConverter, keyType, keyTypeConverter);
        this.prefix = preffix;
    }

    /**
     * @param name {@link String}
     * @return boolean
     */
    @Override
    protected boolean matches(String name) {
        return name.startsWith(this.prefix);
    }

    /**
     * @return the prefix
     */
    public String getPrefix() {
        return this.prefix;
    }

}
